/**
 * <copyright>
 * </copyright>
 *

 */
package it.unibo.iss.domotica.domoticDsl.impl;

import it.unibo.iss.domotica.domoticDsl.Consumption;
import it.unibo.iss.domotica.domoticDsl.DomoticDslPackage;
import it.unibo.iss.domotica.domoticDsl.Elettrodomestico;
import it.unibo.iss.domotica.domoticDsl.Usage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Elettrodomestico</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link it.unibo.iss.domotica.domoticDsl.impl.ElettrodomesticoImpl#getName <em>Name</em>}</li>
 *   <li>{@link it.unibo.iss.domotica.domoticDsl.impl.ElettrodomesticoImpl#getConsumption <em>Consumption</em>}</li>
 *   <li>{@link it.unibo.iss.domotica.domoticDsl.impl.ElettrodomesticoImpl#getUsage <em>Usage</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ElettrodomesticoImpl extends MinimalEObjectImpl.Container implements Elettrodomestico
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getConsumption() <em>Consumption</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getConsumption()
   * @generated
   * @ordered
   */
  protected static final Consumption CONSUMPTION_EDEFAULT = Consumption.LOW;

  /**
   * The cached value of the '{@link #getConsumption() <em>Consumption</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getConsumption()
   * @generated
   * @ordered
   */
  protected Consumption consumption = CONSUMPTION_EDEFAULT;

  /**
   * The default value of the '{@link #getUsage() <em>Usage</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getUsage()
   * @generated
   * @ordered
   */
  protected static final Usage USAGE_EDEFAULT = Usage.ESSENTIAL;

  /**
   * The cached value of the '{@link #getUsage() <em>Usage</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getUsage()
   * @generated
   * @ordered
   */
  protected Usage usage = USAGE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ElettrodomesticoImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return DomoticDslPackage.Literals.ELETTRODOMESTICO;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DomoticDslPackage.ELETTRODOMESTICO__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Consumption getConsumption()
  {
    return consumption;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setConsumption(Consumption newConsumption)
  {
    Consumption oldConsumption = consumption;
    consumption = newConsumption == null ? CONSUMPTION_EDEFAULT : newConsumption;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DomoticDslPackage.ELETTRODOMESTICO__CONSUMPTION, oldConsumption, consumption));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Usage getUsage()
  {
    return usage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setUsage(Usage newUsage)
  {
    Usage oldUsage = usage;
    usage = newUsage == null ? USAGE_EDEFAULT : newUsage;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, DomoticDslPackage.ELETTRODOMESTICO__USAGE, oldUsage, usage));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case DomoticDslPackage.ELETTRODOMESTICO__NAME:
        return getName();
      case DomoticDslPackage.ELETTRODOMESTICO__CONSUMPTION:
        return getConsumption();
      case DomoticDslPackage.ELETTRODOMESTICO__USAGE:
        return getUsage();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case DomoticDslPackage.ELETTRODOMESTICO__NAME:
        setName((String)newValue);
        return;
      case DomoticDslPackage.ELETTRODOMESTICO__CONSUMPTION:
        setConsumption((Consumption)newValue);
        return;
      case DomoticDslPackage.ELETTRODOMESTICO__USAGE:
        setUsage((Usage)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case DomoticDslPackage.ELETTRODOMESTICO__NAME:
        setName(NAME_EDEFAULT);
        return;
      case DomoticDslPackage.ELETTRODOMESTICO__CONSUMPTION:
        setConsumption(CONSUMPTION_EDEFAULT);
        return;
      case DomoticDslPackage.ELETTRODOMESTICO__USAGE:
        setUsage(USAGE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case DomoticDslPackage.ELETTRODOMESTICO__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case DomoticDslPackage.ELETTRODOMESTICO__CONSUMPTION:
        return consumption != CONSUMPTION_EDEFAULT;
      case DomoticDslPackage.ELETTRODOMESTICO__USAGE:
        return usage != USAGE_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(", consumption: ");
    result.append(consumption);
    result.append(", usage: ");
    result.append(usage);
    result.append(')');
    return result.toString();
  }

} //ElettrodomesticoImpl
